/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package component;

import Globals.AllGlobal;
import component.stringtoimgcomp.FileImageCreator;
import component.stringtoimgcomp.SimpleDrawer;
import java.io.File;
import java.io.IOException;

/**
 *
 * @author Administrator
 */
public class StringToImg {
    private String txt=java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("HAHA");
    private String filepath ="";
    private int width=50;
    private int height=28;
    public StringToImg(String txt,String filepath,int width,int height){
        this.txt=txt;
        this.filepath=filepath;
        this.width=width;
        this.height=height;
    }
    public boolean makeImg(){
        boolean flag=false;
        try{  
                    FileImageCreator creator = new FileImageCreator(new SimpleDrawer(), filepath+java.util.ResourceBundle.getBundle("myproj/globalizefile").getString(".JPG"));  //这样吧！这个默认有个工作区间吧，把我的文件都放在那里也好管理
                    creator.setWidth(width); //图片宽度  
                    creator.setHeight(height); //图片高度  
    //                creator.setLineNum(20); //干扰线条数  
                    creator.setFontSize(18); //字体大小  
                    creator.setFontName(java.util.ResourceBundle.getBundle("myproj/globalizefile").getString("黑体"));  
                    creator.generateImage(txt);   
                    flag=true;              
            }catch(IOException ex){  
            }finally{
            return flag;
        }
    }
}
